package com.wms.controller;

import com.wms.bean.ResultBean;
import com.wms.core.R;
import com.wms.entity.StockTakingTaskDetailGroup;
import com.wms.service.StockTakingTaskDetailGroupService;
import com.wms.service.StockTakingTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "skh-盘点任务详情(分组)")
public class StockTakingTaskDetailGroupController {
    @Autowired
    StockTakingTaskDetailGroupService stockTakingTaskDetailGroupService;
    /**
     * 查询盘点任务详情 - 最简单的单接口实现
     * 一次性返回所有需要的数据，前端直接渲染
     */
    @GetMapping("/stockTakingTask/detail")
    @ApiOperation(value = "查询盘点任务详情")
    public ResultBean<StockTakingTaskDetailGroup> getTaskDetail(@RequestParam String code) {
        StockTakingTaskDetailGroup taskDetail = stockTakingTaskDetailGroupService.queryDetailGroupByTaskCode(code);
        if (taskDetail != null) {
            return R.success("查询成功",taskDetail);
        }
        return R.fail("查询失败");
    }
}
